<?php if(!$this->ajax) : ?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<script type='text/javascript' src="../js/popcorn-complete.js"></script>
	<script type="text/javascript" src="../js/jquery.min.js"></script>
	<script type='text/javascript' src="../js/d3.v2.js"></script>
	<script type='text/javascript' src="../js/d3.time.js"></script>
	<script type='text/javascript' src="../js/d3.layout.cloud.js"></script>
	<script type='text/javascript' src="../js/selectsontexte.js"></script>
	<script type='text/javascript' src="../js/selectbar.js"></script>
	<script type='text/javascript' src="../js/tagcloud.js"></script>
	<script type='text/javascript' src="../js/deleuze.js"></script>

	<link rel="stylesheet" href="../css/deleuze.css" />
	
	<script>

		var db = "flux_DeleuzeSpinoza";
		var idExi = '<?php echo $this->idUti; ?>';
		var mailExi = '<?php echo $this->identite;; ?>';
	</script>	
	
</head>
<body>
<?php endif; ?>

	<?php foreach($this->resultats as $r) : ?>
		<div class="ref" id="ref_<?php echo $r['doc_id']; ?>" >
	    	<audio controls='controls' id='audioW_<?php echo $r['doc_id']; ?>' src='<?php echo $r['urlSonLocal']; ?>' ></audio>
			<?php echo $r['doc_id']." - ".$r['titre']; ?>
			<a href="<?php echo $r['url']; ?>"><?php echo $r['url']; ?></a>
			<div id="divSVG_<?php echo $r['doc_id']; ?>" ></div>
			<div class="posi" id="posi_<?php echo $r['doc_id']; ?>" >
				<table>
					<tbody id="table_<?php echo $r['doc_id']; ?>">
					<?php
					 $i = 0;
					 foreach ($r['phrases'] as $p) : ?>
					 		<?php
					 			//important pour l'affichage des sélections : libre_libre_[index dans le tableau des barres de sélection] 
					 			$idElem = $r['doc_id']."_".$i; 
					 		?>
					 		<tr>
					 			<td colspan="2" > 
							 		<div class="Select" id="Select_<?php echo $idElem; ?>" >Automatique 
										<span class="sonSelect" id="Select_son_<?php echo $idElem; ?>" ></span>
								 		<input id='chk_<?php echo $idElem; ?>' type='checkbox' checked='checked' onclick='showSst("<?php echo $idElem; ?>")' >
										<img id="Select_save_<?php echo $idElem; ?>" onclick='saveSst(<?php echo $r['doc_id'].",".$i; ?>)'  src="../img/AddRecord.png" title="Ajouter la sélection à votre compte" />
										<span class="status" id="status_<?php echo $idElem; ?>"></span>
								 	</div>
								</td>
						 	</tr>
					 		<tr id="showSelect_<?php echo $idElem; ?>" >
					 			<td>
									<div class="txtSelect" id="Select_txt_<?php echo $idElem; ?>" ></div>
								</td>
					 			<td>
									<div class="tgcld" id="vis_<?php echo $idElem; ?>"></div>
								</td>
						 	</tr>
					<?php $i++; endforeach; ?>
					<?php
						 $j = 0;
						 foreach ($r['posis'] as $p) : 
						 			$oP = json_decode($p['note']);
						 			$idElem = $r['doc_id']."_".($i+$j)."_".$p['idDoc']."_".$oP->idExi."_".$j;
						 		?>
						 		<tr id="Select_exi_<?php echo $p['idDoc']; ?>">
						 			<td colspan="2" > 
								 		<div class="Select" id="Select_<?php echo $idElem; ?>" ><?php echo $oP->mailExi; ?> 
											<span class="sonSelect" id="Select_son_<?php echo $idElem; ?>" ></span>
									 		<input id='chk_<?php echo $idElem; ?>' type='checkbox' checked='checked' onclick='showSst("<?php echo $idElem; ?>")' >
											<?php
										 		if($this->identite==$oP->mailExi){
										 			echo '<img id="Select_del_'.$p['idDoc'].'" onclick="delSst('.$p['idDoc'].','.$r['doc_id'].',\''.$idElem.'\')"  src="../img/DeleteRecord.png" title="Supprimer la sélection" />
										 			<img id="Select_upd_'.$p['idDoc'].'" onclick="updSst('.$r['doc_id'].','.($i+$j).','.$p['idDoc'].')"  src="../img/UpdateRecord.png" title="Modifier la sélection" />
										 			<!--<img id="Select_tag_'.$p['idDoc'].'" onclick="ajoutTag(\''.$idElem.'\')"  src="../img/tag.png" title="Ajouter un tag" />-->
										 			<img id="Select_tag+_'.$p['idDoc'].'" onclick="poidsTag(\''.$idElem.'\',1)"  src="../img/tag+.png" title="Augmente le poid d\'un tag" />
										 			<img id="Select_tag-_'.$p['idDoc'].'" onclick="poidsTag(\''.$idElem.'\',-1)"  src="../img/tag-.png" title="Diminue le poids d\'un tag" />
										 			<a href= "../deleuze/fragment?id='.$p['idDoc'].'"><img id="Select_lien_'.$p['idDoc'].'" src="../img/lien.png" title="Ouvre un lien direct vers le fragment" /></a>';
										 		}else{
										 			echo '<img id="Select_save_'.$idElem.'" onclick="saveSst('.$r['doc_id'].','.$i.')"  src="../img/AddRecord.png" title="Ajouter la sélection à votre compte" />';
										 		}
											?>
											<span class="status" id="status_<?php echo $idElem; ?>" ></span>
									 	</div>
									</td>
							 	</tr>
						 		<tr id="showSelect_<?php echo $idElem; ?>" >
						 			<td>
										<div class="txtSelect" id="Select_txt_<?php echo $idElem; ?>" ></div>
									</td>
						 			<td>
										<div class="tgcld" id="vis_<?php echo $idElem; ?>"></div>
									</td>
							 	</tr>
						<?php $j++; endforeach; ?>
					</tbody>					 
				</table>
			</div>		 			 	 
		</div>
	  	<script class="sst" >
	  	arrSst[<?php echo $r['doc_id']; ?>] = new selectsontexte({term:"<?php echo $this->term; ?>"
				, data:<?php echo json_encode($r); ?>
				, idDoc:"<?php echo $r['doc_id']; ?>"
				, idExi:"<?php echo $oP->idExi; ?>"});
	  	</script>
		<hr/>
	<?php endforeach; ?>
<?php if(!$this->ajax) : ?>
	<script>
		activeTag();
	</script>
  </body>
</html>
<?php endif; ?>
	